<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">

</head>
<body>

	<div class="layui-fluid">
	<div class="layui-card">

	<div class="layui-form-header">
		<div class="header-left" style="width:70%">
			<div class="layui-inline set-select2">
			  <a class="layui-btn" href="{:url('index',['catid'=>$cat['catid']])}"><i class="layui-icon layui-icon-ok-circle"></i> 自定义单页</a>
			  <a class="layui-btn layui-btn-primary" href="{:url('page_template')}"><i class="layui-icon layui-icon-component"></i>模板管理</a>
			</div>  
		</div>
		
		<div class="header-right" style="width:30%;">
			<div class="layui-inline">
			  <a class="layui-btn layui-btn-primary layui-btn-sm layuiadmin-btn-list iframe" href="{:url('PageRecycle/index')}" data-height="100%" data-width="100%">
				<i class="layui-icon layui-icon-delete"></i> 回收站
			  </a>
			  <a class="layui-btn iframe" data-width="100%" data-height="100%" href="{:url('add',['pagemod'=>1])}"><i class="layui-icon layui-icon-addition"></i> 增加单页</a>
			</div>  
		</div>
	</div>
	<div class="layui-card-body">
	<form class="layui-form" action="{:url('updateSort')}" onsubmit="return save_form(this)" lay-filter="component-form-element">
	<table class="layui-table">
	  <colgroup>
		<col width="150">
		<col width="150">
		<col width="200">
		<col>
	  </colgroup>
	  <thead>
		<tr>
			<th width="5%">排序</th>
			<th width="5%">ID</th>
			<th width="20%">页面名称</th>
			<th width="30%">URL</th>
			<th width="10%">页面模式</th>
			<th width="15%">操作</th>
		</tr> 
	  </thead>
	  <tbody>
	  {foreach $data as $key=>$v}
		<tr>
			<td style="text-align: center;"><input type='text' value="{$v.sort}" name="sort[]" autocomplete="off" style="width:30px; text-align: center;"><input type='hidden' value="{$v.page_id}" name="page_id[]"></td>
			<td style="text-align: center;">{$v.page_id}</td>			
			<td style="text-align: left;">{$v.name}</td>
			<td><a href="{:pageurl($v['page_id'])}" class="tab-title" target="_blank">{:pageurl($v['page_id'])}</a></td>
			<td style="text-align: center;">
				{if $v.pagemod==1}
				直接页面式
				{else/}
				模板式
				{/if}
			</td>
			<td class="center">
			<a href="{:url('update',array('page_id'=>$v['page_id']))}" class="layui-btn layui-btn-sm iframe" data-height="100%" data-width="100%"><i class="layui-icon">&#xe642;</i></a>
			<a href="{:url('delete',array('page_id'=>$v['page_id']))}" class="layui-btn layui-btn-sm ajax_del"><i class="layui-icon">&#xe640;</i></a>
			</td>
		</tr>
	   {/foreach}
	  </tbody>
	</table>
	  <div class="layui-inline">
		  <button class="layui-btn layuiadmin-btn-list" data-type="add">排序</button>
	  </div>    
	</form>	

      
	</div>
</div>

  <script src="/static/admin/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>    
  <script src="/static/js/globals.js"></script>  
  <script>
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form;
    
    form.render(null, 'component-form-element');
    element.render('breadcrumb', 'breadcrumb');
    form.on('checkbox(status)', function(data){
      var checked=data.elem.checked;
	  var status=checked?1:0;
      var id=data.value;
      ajax_del("{:url('setStatus')}?id="+id+"&status="+status,function(msg,data){
		  location.reload();
	  });
    });

  });
  </script>

</body>
</html>
